# $FreeBSD: head/textproc/link-grammar/Makefile 352192 2014-04-26 00:16:54Z bapt $

PORTNAME=	link-grammar
PORTVERSION=	5.0.6
CATEGORIES=	textproc
MASTER_SITES=	http://www.abisource.com/downloads/${PORTNAME}/${PORTVERSION}/

MAINTAINER=	gnome@FreeBSD.org
COMMENT=	Grammar checking library

LICENSE=	LGPL21

LIB_DEPENDS=	libpspell.so:${PORTSDIR}/textproc/aspell

OPTIONS_DEFINE=	DOCS

USES=		dos2unix gmake libtool pathfix pkgconfig perl5
USE_SQLITE=	yes
USE_LDCONFIG=	yes
USE_CSTD=	gnu99
CPPFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib
GNU_CONFIGURE=	yes
CONFIGURE_ARGS=	--enable-pthreads \
		--disable-java-bindings \
		--disable-hunspell \
		--enable-aspell \
		--disable-sat-solver \
		--disable-viterbi
MAKE_JOBS_UNSAFE=	yes
INSTALL_TARGET=	install-strip

PLIST_SUB=	VERSION=${PORTVERSION}

OPTIONS_DEFINE=	EDITLINE PYTHON
EDITLINE_DESC=	Command line editing

DOCS=		AUTHORS LICENSE MAINTAINERS README

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MEDITLINE}
LIB_DEPENDS+=	libedit.so:${PORTSDIR}/devel/libedit
CONFIGURE_ARGS+=--enable-editline
.else
CONFIGURE_ARGS+=--disable-editline
.endif

.if ${PORT_OPTIONS:MPYTHON}
USE_PYTHON=	2
CONFIGURE_ARGS+=--enable-python-bindings
PLIST_SUB+=	PYTHON=""
.else
CONFIGURE_ARGS+=--disable-python-bindings
PLIST_SUB+=	PYTHON="@comment "
.endif

post-patch:
	@${REINPLACE_CMD} -e "s|-lpthread|${PTHREAD_LIBS}|g" \
		${WRKSRC}/configure ${WRKSRC}/${PORTNAME}/Makefile.in

post-install:
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
.for i in ${DOCS}
	@${INSTALL_DATA} ${WRKSRC}/${i} ${STAGEDIR}${DOCSDIR}
.endfor

.include <bsd.port.mk>
